//载入那些函数库
let includes = ([
    "include/common.js",
]);

let inherits = ([
    "inherit/data.js",
]);

function create() {
    return thisObject;
}


function main(me, arg) {

    let env = environment(me);
    if (!objectp(env)) {
        tellObject(me, "你在虚空，请联系巫师..").to();
        return;
    }
    lookRoom(me, env);
}


function lookRoom(me, env) {

    let exits, str;

    if (undefinedp((exits = env.get("exits")))) {
        tellObject(me, "你的四周灰蒙蒙地一片，什么也没有。").to();
        return;
    }

    if (Object.keys(exits).length <= 0) {
        tellObject(me, "这儿没有出口。").to();
        return;
    }
    str = env.get("name") + "   " + fileNameSid(env) +"\n"+ env.get("desc");
    str += "\n这儿的出口有:\n";

    for (let e in exits) {
        if (exits[e] == "") continue;
        let exit = loadObject(exits[e], 1);
        str += exit.get("name") + " <"+ fileNameSid(exit) +">\n";
    }
    str = str.substring(0,str.length-1);

    str+=lookAllInventoryOfRoom(me, env);
    tellObject(me, str).to();


}


function lookAllInventoryOfRoom(me, env) {

    let inObs = allInventory(env);
   let retStr = "\n-------------------------------------\n";
    if (inObs.length > 0) {

        for (let e in inObs) {
            if (inObs[e] == me) continue;
            retStr += inObs[e].get("name") + " <"+fileNameSid(inObs[e])+">\n";
        }
        retStr = retStr.substring(0,retStr.length-1);

    }
    return retStr;
}

/**
 * 房间中的对象的描述
 * @param object
 */
function descOfObjects(obs, me) {


}